# -*- encoding=utf8 -*-
"""
RedFlag-TC000001 入口 
1.进入相机
2.进入相册
"""
__author__ = "ldm"
import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *
auto_setup(__file__)

shooter = CameraVideoShooter()


log("---------------------------------------------------------进入相机--------------------------------------------------------------------")
# 点击进入相机
shooter.enter_photograph()
# 断言
shooter.assert_element_exists(shoot_page_video, "进入拍摄页失败")

# 关闭应用
stop_app("cn.migu.video.clip.walle")


log("---------------------------------------------------------进入相册--------------------------------------------------------------------")
# 点击进入相册
shooter.enter_album()
# 断言
shooter.assert_element_exists(album_full_list, "进入相册页失败")

# 关闭应用
stop_app(UGC_package_name)

# log("---------------------------------------------------------关闭悬浮球---------------------------------------------------------")
# shooter.click_element(UGC_icon)
# shooter.click_element(demo_levitated_sphere)
# shooter.swipe_screen((0.5,0.7), (0.5,0.45))
# target = Template(r"tpl1751510766783.png", record_pos=(0.009, 0.792), resolution=(1224, 2700))
# touch(target)
# sleep(2.0)
# # 关闭应用
# stop_app(UGC_package_name)